<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
<script src="./js/axios.min.js"></script>
    <script>
		//url 地址传参
			//1、普通方式传参
		axios.get('http://localhost:3000/axios?id=1').then((data)=>{
			const {data:res}=data
			//用于解构const {data：res}=data
			//将本来返回的数据为data.data转换成data.res
			console.log(res)
		})
		
			//2、restful形式传递参数
		axios.get('http://localhost:3000/axios/2').then((data)=>{
			const {data:res}=data
			console.log(res)
		})
		
		//params传参
		axios.get('http://localhost:3000/axios',{
			params:{
				id:3
			}
		}).then((data)=>{
			const {data:res}=data
			console.log(res)
		})
		
		axios.delete('http://localhost:3000/axios',{
			params:{
				id:4
			}
		}).then((data)=>{
			const {data:res}=data
			console.log(res)
		})
    </script>	
</body>

</html>